const obj1 = {
    name: "echo",
    foo: function (num1, num2) {
        console.log(this);
        console.log(this.name, num1 + num2);
    }
};
const obj2 = {
    name: "wer"
};
Function.prototype.HYCall = function (thisArg, ...args) {
    let fn = this;
    thisArg = (thisArg !== null && thisArg !== undefined) ? Object(thisArg) : window;
    if (!thisArg) thisArg = window;
    thisArg.fn = fn;
    const result = thisArg.fn(...args);
    delete thisArg.fn;
    return result;
};
obj1.foo.call("", 1, 2);
obj1.foo.HYCall("", 1, 2);